<?php

class Landing extends Controller {

	function Landing()
	{
		
        	// for url redirection on directory
		//define('DIRECTORY_SEGMENT','directory_guest');

        parent::Controller();
        
	//$this->output->enable_profiler(TRUE);
        $this->load->helper(array('form','tiap_helper','html'));
        $this->load->library(array('form_validation','recaptcha'));
        $this->lang->load('recaptcha');
        $this->load->model(array('landing_model','Directory_user_model','Directory_photo_model','Settings_model','Directory_company_model','Directory_services_model'));
        /*$this->load->model(array('Directory_user_model','Settings_model','Network_model','Location_model',
        'User_network_model','Dependency_model','Your_info_model','Home_info_model','User_political_bias_model',
        'Political_party_model','Directory_company_model','Directory_services_model','Directory_branch_model',
        'Directory_news_model'));*/
    
	}
	/*
	function index()
	{
		//$this->load->view(TEMPLATE_NAME.'/front/landing');
        $this->load->view('scaffold/front/landing',$data);
	}
     */
     
     function payment(){// echo 'ttt';
       $this->load->view(TEMPLATE_NAME.'/front/payment',$data);
        
     }
	 
	 function index(){
        $data = array();
		//$this->load->model('landing_model');
		
		//$data['digital_prints'] = $this->landing_model->digital_print();
		
		//$data['litho_prints'] = $this->landing_model->litho_print();
		$data['region_list'] = $this->landing_model->_get_region_by_country(254);
        $this->db->select('name')->from('directory_services')->where('services','category');
        $query = $this->db->get();
        $data['category_list'] = $query->result_array();
        //print_r($result);
         //$data = array();
        $param_array = $this->uri->uri_to_assoc(2,$param_default);  
        
        if($this->input->post('services')){
            $services = $this->input->post('services');    
        }else if(!empty($param_array['services'])){
            $services = $param_array['services'];
        }else{
            $services = 'all';
        }       
       
        $data_services = "''";
        switch($services){
            case "all_services":
                $data['services'] = $services;
                $service_list = $this->Directory_services_model->get_list_services("services");                
                foreach($service_list as $service){
                    $data_services .= " ,'". $service['id'] . "'";
                }
                $services = $data_services;
            break;
            default :
                $data['services'] = $services;
                $services = "'".$services."'";
                 
            break;
        }
        
        if($this->input->post('province')){
            $province = $this->input->post('province');    
        }else if(!empty($param_array['province'])){
            $province = $param_array['province'];
        }else{
            $province = 'all_province';
        }        
        
        $limit = 15;        
        if($this->input->post('search')){
            $search = $this->input->post('search');   
        }else if(!empty($param_array['search'])){
            $search = $param_array['search'];
        }else{
            $search = '';
        }
                
        $total_company = $this->Directory_company_model->get_count_newest_company($province, $services, $search);
        $data['total_company'] = $total_company['count'];
        $submit = $this->input->post('submit');
        if(!empty($search)){
            
            $base_url = site_url('directory/search/'.$search.'/pages');
            $data['search'] = $search;
            if($this->uri->segment(5)){
                $offset = $this->uri->segment(5);    
            }else{
                $offset = 0;
            }
            $uri_segment = 5;
            if($offset == 0){
                $url = '/search/'.$search;
            }else{
                $url = '/search/'.$search.'/pages/'.$offset; 
            }            
        }else{            
            $base_url = site_url('directory/province/'.$province.'/services/'.$data['services'].'/pages');
            if($this->uri->segment(7)){
                $offset = $this->uri->segment(7);    
            }else{
                $offset = 0;
            }
            $uri_segment = 7;
            
            if($offset == 0){
                $url = '/province/'.$province.'/services/'.$data['services'];    
            }else{
                $url = '/province/'.$province.'/services/'.$data['services'].'/pages/'.$offset;
            }            
            
        } 
              
        $this->session->set_userdata(array('url'=>$url));
        
        $this->load->library('pagination'); 
        $config['base_url'] = $base_url;
        $config['total_rows'] = $total_company['count'];
        $config['uri_segment'] = $uri_segment;
        $config['per_page'] = '15';
        
        // First Links
        $config['first_link'] = 'First';
        $config['first_tag_open'] = '<li>';
        $config['first_tag_close'] = '</li>';

        // Last Links
        $config['last_link'] = 'Last';
        $config['last_tag_open'] = '<li>';
        $config['last_tag_close'] = '</li>';

        // Next Link
        $config['next_link'] = 'Next &raquo;';
        $config['next_tag_open'] = '<li class="next">';
        $config['next_tag_close'] = '</li>';

        // Previous Link
        $config['prev_link'] = '&laquo; Previous';
        $config['prev_tag_open'] = '<li class="prev">';
        $config['prev_tag_close'] = '</li>';

        // Current Link
        $config['cur_tag_open'] = '<li class="active">';
        $config['cur_tag_close'] = '</li>';

        // Digit Link
        $config['num_tag_open'] = '<li>';
        $config['num_tag_close'] = '</li>';
        
        $this->pagination->initialize($config);

        $data['pagination'] = $this->pagination->create_links();
        /*if(!empty($_POST))
            die(print_r($_POST));*/
        $company_list = $this->Directory_company_model->get_newest_company($limit, $offset, $province, $services, $search);
        $data['logo_thumbnail_folder'] = $this->Directory_company_model->logo_folder_url.'/thumb/';
        $data['company_list'] = $company_list ;
        $data['side_left_directory'] = 1;
        $data['province'] = $province;
        $ads_limit = 12;
        //$global_ads = $this->landing_model->get_newest_company($ads_limit, $offset, $province, $services, $search, 'global_ads');
        $premium_ads = $this->landing_model->get_newest_company($ads_limit, $offset, $province, $services, $search, 'premium_ads');
        $featured_ads = $this->landing_model->get_newest_company($ads_limit, $offset, $province, $services, $search, 'featured_ads');
        $standard_ads = $this->landing_model->get_newest_company($ads_limit, $offset, $province, $services, $search, 'standard_ads');
        //debug($premium_ads);exit;
      $data['global_ads']=$global_ads;
      $data['premium_ads']=$premium_ads;
      $data['featured_ads']=$featured_ads;
      $data['standard_ads']=$standard_ads;
      $data['services_list'] = $this->Directory_services_model->get_list_services("services");
      $this->load->view(TEMPLATE_NAME.'/front/landing_view',$data);
    }
    function search(){
        $data['region_list'] = $this->landing_model->_get_region_by_country(254);
        $this->db->select('name')->from('directory_services')->where('services','category');
        $query = $this->db->get();
        $data['category_list'] = $query->result_array();
        $data['services_list'] = $this->Directory_services_model->get_list_services("services");
       $this->load->view(TEMPLATE_NAME.'/front/advance_search' , $data); 
    }
     function detail(){
      $data = array();
      $submit_button = $this->input->post('submit');      
      $param_array = $this->uri->uri_to_assoc(1,$param_default);      
      //$company_slug_name = $this->uri->segment(2);
      $company_slug_name = $param_array['directory'];
      $this->load->helper('url');
      $referrerURL = current_url();
      $data['url'] = $this->session->userdata('url'); 
      
      
      $company_detail = $this->Directory_company_model->get_company_by_slug($company_slug_name);
      if(empty($company_detail)){
    	  redirect('directory');
    	  exit;
      }
      //die("here - ".$company_detail['paid_until']);
      //if(strtotime($company_detail['paid_until']) < date('U') ) {
      if(strtotime($company_detail['paid_until']) < strtotime(date('Y-m-d')) ) {       
	   $this->Directory_company_model->set_company_activation($company_detail['id'],'inactive');
	   redirect('directory');
	   exit;
      }
      $data['company_detail'] = $company_detail ;
      $user_detail = $this->Directory_company_model->get_user($company_detail['id']);
      $data['branchList'] = $this->Directory_branch_model->get_branchs($company_detail['id']);

      if($submit_button !== ""){
        $this->form_validation->set_rules('recaptcha_response_field', 'Captcha field', 'callback_check_captcha');
        $this->form_validation->set_rules('message', 'Message', 'required');
        $this->form_validation->set_rules('name', 'Name', 'required');
        $this->form_validation->set_rules('email', 'Email', 'required|valid_email|matches[email]');
        $this->form_validation->set_rules('telephone', 'Telephone Number', 'required');
        $branchOffice = $this->input->post('branchoffice');
        //print_r($branchOffice);
        
        if ($this->form_validation->run() == true) {
            $form_message = $this->input->post('message');
            $form_email = $this->input->post('email');
            $form_name = $this->input->post('name');
            $form_telephone = $this->input->post('telephone');
            if ($this->input->post('headoffice')){
                $this->Directory_company_model->send_contact_email($form_name,$form_email,$form_telephone,$form_message,$user_detail['email'],$referrerURL);
            }
            $bChoose = '';
            if (is_array($branchOffice)){
                $cnt = 0;
                foreach ($branchOffice as $value){
                    $bChoose[$value] = true;
                    $bOffice = $this->Directory_branch_model->get_branch_detail($value);
                    $this->Directory_company_model->send_contact_email($form_name,$form_email,$form_telephone,$form_message,$user_detail['bOffice'],$referrerURL,($cnt>0?true:false));
                    $cnt++;
                }
            }
            $data['messageBox'] = 'Your Message Has Been Sent Into this company';
            $this->Directory_company_model->add_lead_count($company_detail['id']);
        } 
	if(!empty($data['branchList'])){
	  reset($data['branchList']);
	}
        $data['form_message'] = $form_message;
        $data['form_email'] = $form_email;
        $data['form_name'] = $form_name;
        $data['form_telephone'] = $form_telephone;
      }          
      
      $data['logo_thumbnail_folder'] = $this->Directory_company_model->logo_folder_url.'/thumb/';
      $data['photos_thumbnail_folder'] = $this->Directory_company_model->photos_folder_url.'/thumb/';
      $data['photos_real_folder'] = $this->Directory_company_model->photos_folder_url.'/preview/';

      $data['selected_products_list'] = $this->Directory_company_model->get_company_services($company_detail['id'],'products');
      $data['selected_services_list'] = $this->Directory_company_model->get_company_services($company_detail['id'],'services');
      $data['selected_brands_list'] = $this->Directory_company_model->get_company_services($company_detail['id'],'brands');
      $data['news_list'] = $this->Directory_company_model->get_company_news($company_detail['id']);
      $data['photos_list'] = $this->Directory_company_model->get_company_photos($company_detail['id']);
      //die(print_r($data['photos_list']));
      $data['side_left_directory'] = 1;
      $breadcrumb_list = array(
	    array('name'=>'Directory', 'href'=>site_url('directory')),
	    array('name'=>$company_detail['company'], 'href'=>site_url('directory/'.$company_detail['company_slug_name'])),
	  );
      $data['breadcrumb_list'] = $breadcrumb_list;
      $data['recaptcha']=$this->recaptcha->get_html();
      // add view count if user display page detail
      $this->Directory_company_model->add_view_count($company_detail['id']);
       //echo "<pre><font color='#999999'>";print_r($_SERVER["REMOTE_ADDR"]); echo "</font></pre>";
       //echo "<pre><font color='#999999'>";print_r($data); echo "</font></pre>";
      $this->load->view(TEMPLATE_NAME.'/front/directory_guest/detail',$data);
    }
    
    function check_captcha($val) {
        $result = $this->recaptcha->check_answer($_SERVER["REMOTE_ADDR"],$this->input->post('recaptcha_challenge_field'),$val);
        if ($result) {
            return true;
        } else {
            $this->form_validation->set_message('check_captcha','Incorrect Security Image Response');
            return false;
        }
    }
    /*
     * method signup
     * @description halaman yang digunakan untuk mendaftar. url nya tidak menggunakan signup tapi advertise,
     * kenapa nama nya bukan advertise? untuk memudahkan maintenance
     *
     *
     */
    function signup(){
      $data = array();
      $submit_button = $this->input->post('submit');
      if($submit_button !== ""){
	$form_re_email = $this->input->post('re_email');
	$form_email = $this->input->post('email');
	$form_password = $this->input->post('password');
	//$this->directory_user_email = $this->input->post('email');;
	//$this->directory_user_password = $this->input->post('password');
	
    $this->form_validation->set_rules('recaptcha_response_field', 'Captcha field', 'callback_check_captcha');
 	$this->form_validation->set_rules('email', 'Email ', 'required|valid_email|callback_check_email');
 	$this->form_validation->set_rules('re_email', 'Email Confirmation', 'required|valid_email|matches[email]');
        $this->form_validation->set_rules('password', 'Password','required|min_length[6]');
        $this->form_validation->set_rules('re_password', 'Password confirmation','required|min_length[6]|matches[password]');
	if($this->form_validation->run() == TRUE){
	  $directory_user_id = $this->Directory_company_model->register_user($form_email, $form_password);
	  redirect('directory/signup_success/'.$directory_user_id );
	}
	$data['form_email'] = $form_email;
	$data['form_re_email'] = $form_re_email;
	

      }
      $data['side_left_directory'] = 1;
      $breadcrumb_list = array(
	array('name'=>'Directory', 'href'=>site_url('directory')),
	array('name'=>'Advertise', 'href'=>site_url('directory/advertise')),
	);
      $data['breadcrumb_list'] = $breadcrumb_list;
      $data['recaptcha']=$this->recaptcha->get_html();
      $this->load->view(TEMPLATE_NAME.'/front/directory_guest/signup',$data);
    }
    function signup_success(){
    	$directory_user_id = $this->uri->segment(3);
    	$directory_user = $this->Directory_user_model->get_detail($directory_user_id);
    	$submit_button = $this->input->post('submit');
     	if($submit_button == "resend"){
    		//$this->Directory_company_model->register_user($this->directory_user_email, $this->directory_user_password);
    		$activation_link = $this->Directory_company_model->generate_activation_data($directory_user['email'], $directory_user['password_real']);
    		$this->Directory_company_model->send_activation_email($directory_user['email'], '',$activation_link['link']);
     	}
    	if($submit_button == "update"){
    		$form_email = $this->input->post('email');
    		$this->form_validation->set_rules('email', 'Email ', 'required|valid_email|callback_check_email');
    		if($this->form_validation->run() == TRUE){
    			$this->Directory_user_model->update_email($form_email, $directory_user_id);
    			$activation_link = $this->Directory_company_model->generate_activation_data($directory_user['email'], $directory_user['password_real']);
    			$this->Directory_company_model->send_activation_email($form_email, '',$activation_link['link']);
    			//$this->Directory_company_model->register_user($form_email, $this->directory_user_password);
    		}
     	}
     	$data['directory_user_id'] = $directory_user_id;
     	$breadcrumb_list = array(
			array('name'=>'Directory', 'href'=>site_url('directory')),
			array('name'=>'Sign Up Success', 'href'=>site_url('directory/signup_success/'.$directory_user_id))
		);
      	$data['breadcrumb_list'] = $breadcrumb_list;
     	//echo "<pre><font color='#999999'>";print_r($_POST); echo "</font></pre>";
     	//echo "<pre><font color='#999999'>";print_r($directory_user); echo "</font></pre>";
     	
      	$this->load->view(TEMPLATE_NAME.'/front/directory_guest/signup_success', $data);
    }
    function activate(){
      $email_md5 = $this->uri->segment(3);
      $activation_id = $this->uri->segment(4);
      if($email_md5 !="" || $activation_id != ""){
	$activation_result = $this->Directory_company_model->activate_user($email_md5,$activation_id);
	if($activation_result){
	  redirect('directory/activated/success');
	}else{
	  redirect('directory/activated/failed');
	}
      }else{
	redirect('directory/activated/failed');
      }
    }
    function activated(){
      $status = $this->uri->segment(3);
      switch($status){
	case "success":
	  $this->load->view(TEMPLATE_NAME.'/front/directory_guest/activate_success');
		break;
	case "failed":
	  $this->load->view(TEMPLATE_NAME.'/front/directory_guest/activate_failed');
		break;
	default:
	  redirect('directory/advertise');
		break;
      }
    }
    /*
    * method forgot_password
    * forgot password form, to retrieve email , to get link to reset password
    * 
    */
    function forgot_password() {

	//breadcrum config
	$breadcrumb_list = array(
		array('name'=>'Directory', 'href'=>site_url('directory')),
		array('name'=>'Forgot password', 'href'=>site_url('directory/forgot_password')),
		);
	$data['breadcrumb_list'] = $breadcrumb_list;
	$data['side_left_directory'] = 1;
        if ($this->input->post('submit') != '') {
            $this->form_validation->set_rules('username', 'Username',
                'required|min_length[6]|callback_check_forgot');
            if ($this->form_validation->run()) {
                $username = $this->input->post('username', true);
                if ($user_forgoted = $this->Directory_user_model->find_user($username)) {
		    if($user_forgoted['activation_status'] == '1'){
			/*
            $reset_password_code = $this->Directory_user_model->create_reset_password_code($user_forgoted['email'], $user_forgoted['username']);
			$this->Directory_user_model->set_reset_password_code($user_forgoted['id'], $reset_password_code);
			$this->Directory_user_model->send_forgot_password_email($user_forgoted['email'], $user_forgoted['id'], $reset_password_code);
            */
            $this->Directory_user_model->forgot_password_email($user_forgoted['email'], $user_forgoted['password_real']);
            $data['email'] = $user_forgoted['email'];
			$this->load->view(TEMPLATE_NAME . '/front/directory_guest/forgot_password_success', $data);
		    }else{
			$this->Directory_user_model->resend_activation_email($user_forgoted['activation_id']);
			$this->load->view(TEMPLATE_NAME . '/front/directory_guest/forgot_password_inactive');
		    }
                } else {		    
                    $this->load->view(TEMPLATE_NAME . '/front/directory_guest/forgot_password');
                }
            } else {
                $this->load->view(TEMPLATE_NAME . '/front/directory_guest/forgot_password');
            }
        } else {
            $this->load->view(TEMPLATE_NAME . '/front/directory_guest/forgot_password',$data);
        }
    }
    function check_forgot($username){
	$result = $this->Directory_user_model->find_user($username);
        if (empty($result)) {
            $this->form_validation->set_message('check_forgot', 'that %s doesn\'t exists in database. Try another %s');
            return false;
        } else {
            return true;
        }
    }
    /*
    * method reset_password
    * reset password form, to retrieve email , to get link to reset password
    * 
    */
    function reset_password() {
        $username = $this->uri->segment(3);
        $reset_password_code = $this->uri->segment(4);
        if ($username != '' && $reset_password_code != '') {
            $codes = explode('-', $reset_password_code);
            if ($this->Directory_user_model->check_reset_code($username, $codes)) {
                $data = array('username' => $username, 'reset_password_code' => $reset_password_code);
                if ($this->input->post('submit', true) != '') {
                    $this->form_validation->set_rules('password', 'Password',
                        'required|min_length[6]');
                    $this->form_validation->set_rules('retype_password', 're-typed Password',
                        'required|min_length[6]|matches[password]');
                    if ($this->form_validation->run()) {
                        $this->Directory_user_model->reset_password($username, $this->input->post('password', true));
                        redirect('directory/reset_password_success');
                    }
                }
	//breadcrum config
	$breadcrumb_list = array(
		array('name'=>'Sign up', 'href'=>site_url('static_page/signup')),
		);
	$data['breadcrumb_list'] = $breadcrumb_list;

                $this->load->view(TEMPLATE_NAME . '/front/directory_guest/reset_password', $data);
            } else {
                redirect('directory/forgot_password');
            }
        } else {

            redirect('directory/forgot_password');
        }
    }
    /*
    * method reset_password_success 
    * method to test the forgot password template
    */
    function reset_password_success() {
        $this->load->view(TEMPLATE_NAME . '/front/directory_guest/reset_password_success');
    }

    function login(){
    //validation rules  
    if($this->Directory_user_model->check_login()){
		    redirect('directory/panel');
		    exit;
	    }
      $validation = array();
      $validation['username_directory'] = array(
	'field' => 'username_directory',
	'label' => 'Username',
	'rules' => 'trim|required|max_length[50]'
      );
      $validation['password_directory'] = array(
        'field' => 'password_directory',
	'label' => 'Password',
	'rules' => 'trim|required|md5'
      );
      /*
      $validation['remember'] = array(
        'field' => 'remember',
	'label' => 'Remember me',
	'rules' => 'trim|integer]'
      );
       */
    $this->form_validation->set_rules($validation);
      $submit_button = $this->input->post('submit');
      if($submit_button !== ""){ // if submit button pressed
	if($this->form_validation->run()){
	  $username = $this->input->post('username_directory',TRUE);
	  $password = $this->input->post('password_directory',TRUE);
	  $user_data = $this->Directory_user_model->login($username,$password);
	  if($user_data){
	    redirect('directory/panel/index');
	    exit;
	  }
	  $data['error_directory'] = $this->Directory_user_model->error_message; 
	}
	$data['username'] = $this->input->post('username',TRUE);
      }
	//breadcrum config
      
	$breadcrumb_list = array(
		array('name'=>'Directory', 'href'=>site_url('directory')),
		array('name'=>'Login', 'href'=>site_url('directory/login')),
		);
	$data['breadcrumb_list'] = $breadcrumb_list;
    $data['side_left_directory'] = 1;

      $this->load->view(TEMPLATE_NAME.'/front/directory_guest/login',$data);
    }
    function news(){

      $company_slug_name = $this->uri->segment(2);
      $news_slug_name = $this->uri->segment(3);
      $company_detail = $this->Directory_company_model->get_company_by_slug($company_slug_name);
      $news_detail = $this->Directory_news_model->get_news_by_slug($news_slug_name);
      $data['company_detail'] = $company_detail ;
      $data['side_left_directory'] = 1;
      $breadcrumb_list = array(
	    array('name'=>'Directory', 'href'=>site_url('directory')),
	    array('name'=>$company_detail['company'], 'href'=>site_url('directory/'.$company_detail['company_slug_name'])),
	    array('name'=>$news_detail['heading'], 'href'=>site_url('directory/'.$company_detail['company_slug_name'].'/'.$news_slug_name)),
	  );
      $data['logo_thumbnail_folder'] = $this->Directory_company_model->logo_folder_url.'/thumb/';
      $data['photos_thumbnail_folder'] = $this->Directory_company_model->photos_folder_url.'/thumb/';
      $data['photos_real_folder'] = $this->Directory_company_model->photos_folder_url.'/';
      
      $data['news_detail'] = $news_detail;
      $data['breadcrumb_list'] = $breadcrumb_list;
      $data['recaptcha']=$this->recaptcha->get_html();
      $news_list = $this->Directory_company_model->get_company_news($company_detail['id']);
      $data['news_list'] = $news_list;   
	  /* Pagination begin */
      if(!empty($news_list)){
      foreach ($news_list as $news){
      	$array_news[] = $news['news_slug_name']; 
      }
      $start = array_search($news_slug_name, $array_news);
      }
	  $num = count($array_news); // number of items in list
	  $per_page = 1; // Number of items to show per page
      if(($start-$per_page) >= 0){ // previous link
	    $next = $start-$per_page;
		$data['link_prev'] = site_url('directory/'.$company_detail['company_slug_name'].'/'.$array_news[$next]); 
	
	  }
      if($start+$per_page<$num){ // next link
		$prev = max(0,$start+$per_page);
		$data['link_next'] = site_url('directory/'.$company_detail['company_slug_name'].'/'.$array_news[$prev]);
	  }
      
	  /* Pagination end */      
      $data['photos_list'] = $this->Directory_company_model->get_company_photos($company_detail['id']);
      $this->Directory_news_model->add_view_count($news_detail['id']);

      //echo "<pre><font color='#999999'>";print_r($array_news); echo "</font></pre>";
      //echo "<pre><font color='#999999'>";print_r($data); echo "</font></pre>";
      $this->load->view(TEMPLATE_NAME.'/front/directory_guest/news',$data);
    }
    function check_email($val) {
        if (!$this->Directory_company_model->check_available_email($val)) {
            $this->form_validation->set_message('check_email', '%s ' . $val .
                ' is already on our system, please use another %s');
            return false;
        } else {
            return true;
        }
    }

    
  function logout()
  {
    $this->load->model('rememberme_cookies_model');
    if ($this->session->userdata('directory_user_id'))
    {
      //check rememberme cookies
      $cookie_data = $this->rememberme_cookies_model->read_cookies();
      if ($cookie_data AND is_array($cookie_data) AND $cookie_data['directory_user_id'] == $this->session->userdata('directory_user_id'))
      {
        //unset rememberme cookies and db data
        $result = $this->rememberme_cookies_model->delete($cookie_data['directory_user_id'], $cookie_data['directory_series']);
      }
    }
    //facebook logout
    $this->load->library('facebook_connect');
    $_COOKIE['fbs_'.$this->config->item('facebook_api_key')] = "";
    if($this->session->userdata('facebook_user')){

    $this->session->unset_userdata('facebook_user');
    //print_r($this->session->userdata('facebook_user'));
    //$this->facebook_connect->client->auth_expireSession();
    }
    //unset session
    $this->Directory_user_model->unset_user_session();
    //set variables
    $data['message'] = 'You have been logged out';
    $reload = 'login';
    $data['reload'] = site_url($reload);
    //if ajax request
    redirect('directory',true);
  }
  
    
   
}

/* End of file landing.php */
/* Location: ./system/application/controllers/landing.php */
